package com.hongyuan.venue.ui.home.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;
import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.venue.base.ItemViewModel;
import com.hongyuan.venue.ui.home.activity.TrainningDetailActivity;
import com.hongyuan.venue.ui.home.beans.Venue;

public class HomeTrainingItemViewModel extends ItemViewModel<FragmentHomeViewModel> {

    public ObservableField<Venue.CourseTrainListBean> entity = new ObservableField<>();

    public int position;
    public int maxPosition;

    public HomeTrainingItemViewModel(@NonNull FragmentHomeViewModel viewModel, Venue.CourseTrainListBean bean,int i,int maxPosition) {
        super(viewModel);

        entity.set(bean);
        position = i;
        this.maxPosition = maxPosition;
    }

    //条目的点击事件
    public BindingCommand goDetails = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("ct_id",String.valueOf(entity.get().getCt_id()));
            viewModel.startActivity(TrainningDetailActivity.class,bundle);
        }
    });

}
